import Vue from 'vue'
import Router from 'vue-router'

//在router对象引入组件
import one from "../components/one.vue"
import two from "../components/two.vue"
import three from "../components/three.vue"

import oneOne from "../components/oneChildren/oneOne.vue"
import oneTwo from "../components/oneChildren/oneTwo.vue"

//Vue使用路由功能
Vue.use(Router)

export default new Router({
	//路由配置项
	routes:[
		{	
			//地址栏访问路径为#/one
			path:"/one",
			//显示的组件为one组件
			component:one,
			//子路由配置项
			children: [
				{
					//子路径不用加/斜杠
					//地址栏访问路径为#/one/one自动拼接
					path:"one",
					component:oneOne
				},
				{
					path:"two",
					component:oneTwo
				}
			]
		},
		{
			path:"/two",
			component:two
		},
		{
			path:"/three",
			component:three
		},
		{
			//多个路由容器
			path:"/four",
			components:{
				second:oneOne
			}
		}
	]
})
